// ------------------ 1.type 注解对象 ------------------
type GoodsType = {
  id:string
  price:number
}

// ------------------ 2.type 相当于interface 的继承 ------------------
// 交叉类型 &
type DisGoodsType = GoodsType & {
  discount:number
}

const p:DisGoodsType = {
  id:'001',
  price:1000,
  discount:900
}
console.log(p);

// ------------------- 3.type 思考题 对象嵌套 -------------------
type Response = {
  code :number
  msg:string
  data:Article
}

type Article = {
  title:string
  content:string
}

const res:Response = {
  code:200,
  msg:'success',
  data:{
    title:'标题',
    content:'内容'
  }
}

console.log(res);

